﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO.WaiGaoQiao;
using System.Data;

namespace Model.WaiGaoQiao
{
    public class Work_GasInfo
    {
        private DataAccessWork_Gas workGasAccess;

        public Work_GasInfo()
        {
            workGasAccess = new DataAccessWork_Gas();
        }
        /// <summary>
        /// 天然气数量
        /// </summary>
        /// <returns></returns>
        public int GetWork_GasCount(string Condition)
        {
            return workGasAccess.GetWork_GasCount(Condition);
        }
        #region  -----------------字段------------
        /// <summary>
        /// ID
        /// </summary>
        public int ID { get; set; }
        /// <summary>
        /// 抄表日期
        /// </summary>
        public DateTime CBDT { get; set; }
        /// <summary>
        /// 班组编号
        /// </summary>
        public string GroupNo { get; set; }
        /// <summary>
        /// 当班人员
        /// </summary>
        public string GroupMan { get; set; }
        /// <summary>
        /// 机器编号
        /// </summary>
        public string MachNo { get; set; }
        /// <summary>
        /// 开机时间
        /// </summary>
        public DateTime OpenMachDt { get; set; }
        /// <summary>
        /// 停机时间
        /// </summary>
        public DateTime StopMachDt { get; set; }
        /// <summary>
        /// 燃气类型（采暖/制冷
        /// </summary>
        public int RanqiType { get; set; }
        /// <summary>
        /// 项目 
        /// </summary>
        public int TeamNo { get; set; }
        /// <summary>
        /// 7:00（19:00）
        /// </summary>
        public string StartTime { get; set; }
        /// <summary>
        /// 8:00（20:00）
        /// </summary>
        public string OneTime { get; set; }
        /// <summary>
        /// 9:00（21:00）
        /// </summary>
        public string TwoTime { get; set; }
        /// <summary>
        /// 10:00（22:00）
        /// </summary>
        public string ThreeTime { get; set; }
        /// <summary>
        /// 11:00（23:00）
        /// </summary>
        public string FourTime { get; set; }
        /// <summary>
        /// 12:00（00:00)
        /// </summary>
        public string FiveTime { get; set; }
        /// <summary>
        /// 13:00（1:00）
        /// </summary>
        public string SixTime { get; set; }
        /// <summary>
        /// 14:00（2:00）
        /// </summary>
        public string SevenTime { get; set; }
        /// <summary>
        /// 15:00（3:00）
        /// </summary>
        public string EightTime { get; set; }
        /// <summary>
        /// 16:00（4:00）
        /// </summary>
        public string NineTime { get; set; }
        /// <summary>
        /// 17:00（5:00）
        /// </summary>
        public string TenTime { get; set; }
        /// <summary>
        /// 18:00（6:00）
        /// </summary>
        public string ElevenTime { get; set; }
        /// <summary>
        /// 记录插入时间（自动获取）
        /// </summary>
        public DateTime CreateDt { get; set; }
        #endregion

        /// <summary>
        ///根据id获取天然气录入对象
        /// </summary>
        /// <param name="pagesize"></param>
        /// <param name="startindex"></param>
        /// <returns></returns>
        public Work_GasInfo GetCon_GasById(int Id)
        {
            Work_GasInfo comInfo = new Work_GasInfo();
            DataSet ds = workGasAccess.GetWork_GasById(Id);

            if ((ds != null) && (ds.Tables[0].Rows.Count > 0))
            {
                DataRow item = ds.Tables[0].Rows[0];

                comInfo = new Work_GasInfo()
                {
                    ID = Convert.ToInt32(item[0]),
                    CBDT=Convert.ToDateTime(item[1]),
                    GroupNo=Convert.ToString(item[2]),
                    GroupMan = Convert.ToString(item[3]),
                    MachNo = Convert.ToString(item[4]),
                    OpenMachDt = Convert.ToDateTime(item[5]),
                    StopMachDt = Convert.ToDateTime(item[6]),
                    RanqiType = Convert.ToInt32(item[7]),
                    TeamNo = Convert.ToInt32(item[8]),
                    StartTime = Convert.ToString(item[9]),
                    OneTime = Convert.ToString(item[10]),
                    TwoTime = Convert.ToString(item[11]),
                    ThreeTime = Convert.ToString(item[12]),
                    FourTime = Convert.ToString(item[13]),
                    FiveTime = Convert.ToString(item[14]),
                    SixTime = Convert.ToString(item[15]),
                    SevenTime = Convert.ToString(item[16]),
                    EightTime = Convert.ToString(item[17]),
                    NineTime = Convert.ToString(item[18]),
                    TenTime = Convert.ToString(item[19]),
                    ElevenTime = Convert.ToString(item[20]),
                    CreateDt = Convert.ToDateTime(item[21])
                   };
            }
            return comInfo;
        }
        /// <summary>
        /// 保存天然气录入
        /// </summary>
        /// <param name="dmpara"></param>
        /// <returns></returns>
        public int SaveWork_Gas(Work_GasInfo dminfo)
        {
            object[] dpmpara = new object[] { dminfo.CBDT,dminfo.GroupNo,dminfo.GroupMan,                                      dminfo.MachNo,dminfo.OpenMachDt,dminfo.StopMachDt,dminfo.RanqiType,dminfo.TeamNo,dminfo.StartTime,dminfo.OneTime,dminfo.TwoTime,dminfo.ThreeTime,dminfo.FourTime,dminfo.FiveTime,dminfo.SixTime,dminfo.SevenTime,dminfo.EightTime,dminfo.NineTime ,dminfo.TenTime,dminfo.ElevenTime,dminfo.CreateDt};
            return workGasAccess.SaveWork_Gas(dpmpara);
        }
        /// <summary>
        /// 根据条件获取所有天然气录入。
        /// </summary>
        /// <param name="pagesize"></param>
        /// <param name="startindex"></param>
        /// <returns></returns>
        public IList<Work_GasInfo> GetAllCon_Gas(string condition)
        {
            IList<Work_GasInfo> dmlist = new List<Work_GasInfo>();
            Work_GasInfo dminfo;
            DataSet ds = workGasAccess.GetAllWork_Gas(condition);
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                dminfo = new Work_GasInfo();
                {
                    dminfo.ID = Convert.ToInt32(item[0]);
                    dminfo.CBDT = Convert.ToDateTime(item[1]);
                    dminfo.GroupNo = Convert.ToString(item[2]);
                    dminfo.GroupMan = Convert.ToString(item[3]);
                    dminfo.MachNo = Convert.ToString(item[4]);
                    dminfo.OpenMachDt = Convert.ToDateTime(item[5]);
                    dminfo.StopMachDt = Convert.ToDateTime(item[6]);
                    dminfo.RanqiType = Convert.ToInt32(item[7]);
                    dminfo.TeamNo = Convert.ToInt32(item[8]);
                    dminfo.StartTime = Convert.ToString(item[9]);
                    dminfo.OneTime = Convert.ToString(item[10]);
                    dminfo.TwoTime = Convert.ToString(item[11]);
                    dminfo.ThreeTime = Convert.ToString(item[12]);
                    dminfo.FourTime = Convert.ToString(item[13]);
                    dminfo.FiveTime = Convert.ToString(item[14]);
                    dminfo.SixTime = Convert.ToString(item[15]);
                    dminfo.SevenTime = Convert.ToString(item[16]);
                    dminfo.EightTime = Convert.ToString(item[17]);
                    dminfo.NineTime = Convert.ToString(item[18]);
                    dminfo.TenTime = Convert.ToString(item[19]);
                    dminfo.ElevenTime = Convert.ToString(item[20]);
                    dminfo.CreateDt = Convert.ToDateTime(item[21]);

                }
                dmlist.Add(dminfo);

            }
            return dmlist;
        }
        /// <summary>
        /// 获取所有天然气录入
        /// </summary>
        /// <param name="pagesize"></param>
        /// <param name="startindex"></param>
        /// <returns></returns>
        public IList<Work_GasInfo> GetAllCon_Gas(string Condition, int pagesize, int startindex)
        {
            IList<Work_GasInfo> dmlist = new List<Work_GasInfo>();
            Work_GasInfo dminfo;
            DataSet ds = workGasAccess.GetAllWork_Gas(Condition, pagesize, startindex);
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                dminfo = new Work_GasInfo();
                {
                    dminfo.ID = Convert.ToInt32(item[0]);
                    dminfo.CBDT = Convert.ToDateTime(item[1]);
                    dminfo.GroupNo = Convert.ToString(item[2]);
                    dminfo.GroupMan = Convert.ToString(item[3]);
                    dminfo.MachNo = Convert.ToString(item[4]);
                    dminfo.OpenMachDt = Convert.ToDateTime(item[5]);
                    dminfo.StopMachDt = Convert.ToDateTime(item[6]);
                    dminfo.RanqiType = Convert.ToInt32(item[7]);
                    dminfo.TeamNo = Convert.ToInt32(item[8]);
                    dminfo.StartTime = Convert.ToString(item[9]);
                    dminfo.OneTime = Convert.ToString(item[10]);
                    dminfo.TwoTime = Convert.ToString(item[11]);
                    dminfo.ThreeTime = Convert.ToString(item[12]);
                    dminfo.FourTime = Convert.ToString(item[13]);
                    dminfo.FiveTime = Convert.ToString(item[14]);
                    dminfo.SixTime = Convert.ToString(item[15]);
                    dminfo.SevenTime = Convert.ToString(item[16]);
                    dminfo.EightTime = Convert.ToString(item[17]);
                    dminfo.NineTime = Convert.ToString(item[18]);
                    dminfo.TenTime = Convert.ToString(item[19]);
                    dminfo.ElevenTime = Convert.ToString(item[20]);
                    dminfo.CreateDt = Convert.ToDateTime(item[21]);
                }
                dmlist.Add(dminfo);

            }
            return dmlist;
        }


     
    }
}
